package AntFarm;

public class Food extends TileContent {

	public Food()
	{
		System.out.println(this.getClass().getName() + " created");			
	}


	public void visit(TileContent tileContent) throws MovedToOtherTileException
	{
		System.out.println( tileContent.getClass().getName()  + " visits " +this.getClass().getName());
		try {
			tileContent.accept(this);	
		} catch (MovedToOtherTileException e) {
			throw e;
		} catch (CantMoveToThisTileEception e) {
			e.printStackTrace();
		}			
	}
	
	public void accept(Ant ant)
	{
		System.out.println(this.getClass().getName() + " accept " + ant.getClass().getName());		
		this.position.removeTileContent(this);
		ant.pickUpFood(this);	
		 
	}




}